﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using AjaxControlToolkit;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_KC : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
    }
    public void ddlKu_SelectedIndexChanged(object sender, EventArgs e)
    {
        switch (ddlKu.SelectedValue.ToString())
        {
            case "一高线":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("普碳线材");
                    ddlPinzhong.Items.Add("品种线材");
                    ddlPinzhong.Items.Add("棒材");
                    ddlPinzhong.Items.Add("方坯");

                }; break;
            case "二高线":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("普碳线材");
                    ddlPinzhong.Items.Add("品种线材");
                    ddlPinzhong.Items.Add("方坯");
                }; break;
            case "四轧库":
            case "大棒线":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("棒材");
                    ddlPinzhong.Items.Add("方坯");
                }; break;

            case "板材库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("板材");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "不锈钢热轧库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("不锈钢热轧卷板");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "不锈钢冷轧库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("不锈钢冷轧卷板");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "碳钢热轧库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("碳钢热轧卷板");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "碳钢冷轧库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("碳钢冷轧卷板");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "嘉东库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("方坯");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "酸洗库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("不锈钢酸洗板");
                    ddlPinzhong.Items.Add("板坯");
                }; break;
            case "化产库":
                {
                    ddlPinzhong.Items.Clear();
                    ddlPinzhong.Items.Add("请选择品种");
                    ddlPinzhong.Items.Add("化学产品");
                }; break;
            default:
                break;


        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        KcInfo kc = new KcInfo();
        kc.Ku = ddlKu.SelectedValue.ToString();
        kc.Pinzhong = ddlPinzhong.SelectedValue.ToString();
        kc.Guige = txtGuige.Text.ToString();
        kc.Num = BLLFactory.CreateKcBLL().AUTOID();
        checkValue = BLLFactory.CreateKcBLL().AddKc(kc);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        Response.Redirect("KCJGJL.aspx");

    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        ddlKu.SelectedIndex = 0;
        ddlPinzhong.Items.Clear();
        txtGuige.Text = "";

    }
}
